Skip to content

fix(cli): judge install-from-source lease admission by its daemon command - #5169

Merged
thymikee merged 5 commits into
mainfrom
fix/lease-admission-eligibility
Nov 28, 2026
Merged

thymikee merged 5 commits into
mainfrom
fix/lease-admission-eligibility

Conversation

@thymikee

@thymikee thymikee commented Nov 28, 2026 •

Copy link
Copy Markdown
Member

Summary

Follows #5151 and the #5165 mutation audit. install-from-source runs as install_source, but two checks mixed the names. Both now use resolveDaemonCommandName (from servesPublicCommand).

  • Admission: an http(s) URL source may skip the heartbeat, since the daemon downloads it. Other sources keep it.
  • Proxy: install-from-source now allocates like install (by spec without --udid/--serial). Help updated.
  • Adds the missing lease-backend test.

Before / after

install-from-source https://…:

  • Reused lease: base sends lease_heartbeat, install_source; head sends one admission-checked install_source.
  • Proxy, no stored lease: base fails run open first; head allocates.

Validation

The three changed test files at c814ec7: 59 passed (help string edited after that run).

The new proxy test fails with run open first when the lookup is reverted, and passes with the fix.

Mutations at 4a85bbc:

  • Deleting state.leaseBackend !== options.leaseBackend fails the backend test.
  • Skipping name resolution fails both URL tests.
  • Treating every install_source as upload-free fails the local-path test.

An explicit backend mismatch is refused earlier, so the backend test stores none; it reallocates. CI pending.

Security

Resend and heartbeat rules are unchanged. With real client and daemon, on a non-proxy-provider connection, a refused URL install sends no heartbeat and is resent once. install, reinstall and local paths keep the heartbeat.

🤖 Generated with Claude Code

…mand

The admission check asked the daemon registry about the public name, which it
does not declare, so install-from-source kept the heartbeat by a failed lookup.
Resolve the daemon command first; an http(s) URL source uploads nothing and may
use admission, and any other source keeps the heartbeat.

Also pin that a stored lease without its own backend is not admission-checked.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Size Report

Metric Base Current Diff
Installed (including dependencies) 6.68 MB 6.68 MB +547 B
Package (unpacked) 6.68 MB 6.68 MB +547 B
Package (download) 2.04 MB 2.04 MB +222 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 20.0 ms 20.6 ms +0.6 ms
CLI --help 44.8 ms 44.2 ms -0.5 ms

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 6 files

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

thymikee and others added 2 commits November 28, 2026 11:06
The proxy lease policy lists the daemon command install_source but looked up the
public CLI name, so install-from-source without a stored lease failed with "run
open first". Resolve the daemon command before the lookup.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@apex-sentinel-staging

This comment has been minimized.

@thymikee

Copy link
Copy Markdown
Member Author

The code at c5fb827 needs one fix: the proxy help now promises flags that install-from-source refuses.

The help sentence now includes install-from-source, and the next sentence says --os, --image-tag, --device-mode, --device-baseline and --physical add a device spec to that request. installFromSourceCliSchema.allowedFlags omits LEASE_DEVICE_SPEC_FLAGS, so agent-device install-from-source <url> --platform android --os 34 fails with INVALID_ARGS "Flag --os is not supported for command install-from-source." A reader who follows the help gets a refused command, and the comment at line 37 of flag-groups.ts ("the commands that allocate a proxy lease take it") is no longer true. Every command that the help says accepts the spec flags must declare them. The smallest fix is to name only open, install, reinstall and uninstall in the flag sentence, since a spec stored by connect proxy still applies to install-from-source. For real parity instead, add LEASE_DEVICE_SPEC_FLAGS to the schema, leaseDeviceSpecInputFromFlags to its reader and leaseDeviceSpecFields to its metadata (so a plain daemon refuses the keys instead of ignoring them), then regenerate commands.md and update remote-proxy.md; the command above must then pass flag parsing and carry the spec in the lease request.

Not blocking: these can be taken or left: export isHttpUrl or a source predicate from the install command module and use it in uploadsBeforeAdmission, which repeats that URL test and source lookup; either keep the local-path test row as a guard or also assert the CLI refusal it stops at (the row also passes on base); say in the doc block that an http(s) install_source is the only case the CLI treats as upload-free, since some install/reinstall paths upload nothing either; as a follow-up, accept or suppress the second "Installing..." notice that a LEASE_NOT_FOUND resend can print on a TTY outside CI; and, along with the fix above, name install-from-source among the allocating commands in the lease contract and remote-proxy.md.

The earlier documentation thread no longer applies, because the text now says the other list items still apply to an http(s) URL.

Not verified here: no tests, CLI commands or device runs were performed, so the flag refusal and the regression value of the tests were judged from the code, schema and generated docs. Not verified here: the by-spec install-from-source path against a real backend (a unit test with a fake client covers it, and the real proxy/daemon test row uses a non-proxy-provider connection), including that a reallocated lapsed lease may land on a different device, as intended.

All 21 checks pass at this commit. Before merge, the proxy help must be true for install-from-source.

install-from-source allocates through the proxy but its schema takes no
spec flags, so the help no longer promises them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@apex-sentinel-staging

This comment has been minimized.

@apex-sentinel-staging apex-sentinel-staging Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apex Sentinel: 1 new finding on a94a0d1. The verdict and the full list are in the summary comment.

Comment thread src/cli/commands/proxy-lease-device.ts Resolved
@thymikee

Copy link
Copy Markdown
Member Author

The PR is ready at a94a0d1. The problem from the earlier review is fixed: the proxy help no longer promises device spec flags for install-from-source.

Not blocking: this can be taken or left: in the lease contract, add "unless another item in this list applies" to the sentence about by-spec allocations that name no spec or selector, because install, reinstall and install-from-source with a non-URL source on a stored proxy device still send a heartbeat.

Two earlier threads do not apply and can be resolved: this one is fixed, since the contract now says the other list items still apply to an http(s) URL, and this one needs no change, since strict flag parsing refuses spec flags on install-from-source and spec keys reach it only as stored profile or connection defaults.

All 22 checks pass. No further change is required before merge.

Not verified here: no tests, CLI commands or device runs were executed, so the flag refusal and the stored-default route were traced in code. Not verified here: the by-spec install-from-source route was not exercised against a real proxy backend (unchanged since the earlier review), and the test and mutation results in the PR description were not re-run.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Nov 28, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@apex-sentinel-staging

Copy link
Copy Markdown

Apex Sentinel · ✅ Approve · review of 0e74db6

Since the review of a94a0d1: 0 new · 0 still open · 1 no longer raised

No open findings.

Reviewed with this repository's own Sentinel configuration (411b2a746e60).

💬 Talking to Sentinel

In a finding's thread, reply with:

Command What it does
@apex-sentinel-staging note <context> Adds context; Sentinel re-checks the cited code
@apex-sentinel-staging pivot <why> Says the finding is wrong; Sentinel re-checks the cited code
@apex-sentinel-staging like Marks the finding as useful
@apex-sentinel-staging dislike <why> Marks it as not useful, so it is not raised again

On this conversation, comment @apex-sentinel-staging review to run a full review once again.

@thymikee thymikee removed the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Nov 28, 2026
@thymikee

Copy link
Copy Markdown
Member Author

No code problems were found at 0e74db6. The change since the earlier review of a94a0d1 is one documentation line, and no requested changes remain.

Two open threads no longer apply and can be resolved. The first thread, about the lease contract text for http(s) URLs, is fixed at this commit. The second thread needs no change: strict parsing refuses spec flags on install-from-source, so the help text holds, and stored connect proxy spec defaults apply like stored --platform and --device.

The 22 reported CI checks show no failures, and the required evidence is in place. Not verified here: tests, CLI commands and device runs were not executed, and behavior was traced in code. The stored-default spec route was not traced again because that code is unchanged since a94a0d1. Test and mutation results in the PR description were not re-run.

Nothing else needs to change before merge.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Nov 28, 2026
@thymikee
thymikee merged commit d2a4abe into main Nov 28, 2026
22 checks passed
@thymikee
thymikee deleted the fix/lease-admission-eligibility branch November 28, 2026 13:21
thymikee added a commit that referenced this pull request Nov 28, 2026
* origin/main:
  fix(cli): judge install-from-source lease admission by its daemon command (#5169)
  ci: report sizes for affected plugins (#5176)
  fix(ios): keep the zh-Hans alert vocabulary check honest about OS versions (#5177)
  Consolidate Apple tap and replacement result construction (#5161)
  fix(daemon): retry provider lease record retirement (#5174)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-human Valid work that needs human implementation, judgment, or maintainer merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant